package com.zhanglijie.theory.workthread;

/**
 * @author zhanglijie
 * @version 1.0
 * @since 1.1.0 2022/8/14 0014 20:33
 */
public class WorkerThread extends Thread{
    private ContractFolder contractFolder;
    public WorkerThread(String name,ContractFolder contractFolder ){
        super(name);
        this.contractFolder = contractFolder;
    }

    @Override
    public void run() {

        while (true){
            try {
                Contract contract = contractFolder.getContract();
                contract.execute();
            }catch (Exception e){
                e.printStackTrace();
            }
        }
    }
}
